package me.leiusual.sharing.repository

import io.reactivex.Single
import me.leiusual.sharing.api.ApiSharing
import me.leiusual.sharing.api.model.Address
import javax.inject.Inject
import javax.inject.Singleton

/**
 * author: leiusual
 * create on: 2019-07-29
 * description:
 */
@Singleton
class AddressRepository @Inject constructor(
    private val apiSharing: ApiSharing
) {

  fun address(userId: Long): Single<List<Address>> {
    return apiSharing.address(userId)
  }

  fun addressDelete(aId: Long): Single<Unit> {
    return apiSharing.addressDelete(aId)
  }

  fun addressList(): Single<List<Address>> {
    return apiSharing.addressList()
  }

  fun addressRegionQuery(k: String): Single<Map<Long, String>> {
    return apiSharing.addressRegionQuery(k)
  }

  fun addressSms(phone: String): Single<Unit> {
    return apiSharing.addressSms(phone)
  }

  fun addressUpdate(address: Address): Single<Unit> {
    return apiSharing.addressUpdate(address)
  }
}